from flask_restplus import fields
from flask_restplus.model import Model

from hzb.common.field import BaseResp

from .. import users_api

# 注册对应的Common类
users_api.models['BaseResp'] = BaseResp

# REQ
UserGetTokenReq = users_api.model('UserGetTokenReq', {
    'user_id': fields.String(required=True, description='用户id', default=None),
    'unionid': fields.String(description='用户的unionid', default=None),
})
UserLoginResp = users_api.inherit('UserLoginResp', BaseResp, {
    'token': fields.String(required=True, description='登录'),
    'user_id': fields.Integer(required=True, description='用户id'),
})
GetTokenByCodeReq = users_api.model('GetTokenByCodeReq', {
    'code': fields.String(required=True, description='用户从微信获取的code', default=None),
})

# 设置用户信息req
SetUserInfoReq = users_api.model('SetUserInfoReq', {
    'name': fields.String(required=True, description='用户名'),
    'city': fields.String(required=True, description='用户城市'),
    'sex': fields.Integer(required=True, description='用户性别'),
    'icon': fields.String(required=True, description='用户头像'),
})
